// npm install --save js-cookie
import cookie from 'js-cookie';

//To get started, export the state as a function, and the getters, mutations and actions as objects.
export const state = () => ({
  counter: 0,
  locales: ['en-US', 'zh-CN'],
  locale: 'zh-CN',
  token: '',
  userInfo: '',
  username: '',
  redirectUrl: '',
  headNotificationsList: '', //导航条通知数据
  headMessageList: '', //导航条站内信数据
  billInfo: '', //bill详情
  resetPrevLoginUrl: '', //存储跳转登陆前的页面路径
  resetPrevLoginCreateDialog: false, //判断跳转登陆后，是不是显示选择剧本列表弹出框
  peoplesInfo: {}
});

export const getters = {
  getCounter(state) {
    return state.counter
  }
}
//通过this.$store.commit调用
export const mutations = {
  increment(state) {
    state.counter++
  }
};
//通过this.$store.dispatch调用
export const actions = {
  async fetchCounter({ state }) {
    // make request
    const res = { data: 10 };
    state.counter = res.data;
    return res.data;
  },

};
